package com.lzy.cloud.permission.facade;

import com.lzy.cloud.permission.dtos.RoleResourcePermissionDto;
import com.lzy.cloud.permission.service.PermissionService;
import com.lzy.cloud.permission.service.RoleResourcePermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by WIN7 on 2018/5/18.
 */
@Component
public class PermissionFacade {

    @Autowired
    PermissionService permissionService;

    @Autowired
    RoleResourcePermissionService roleResourcePermissionService;

    public Boolean delPermission(Long id) {
        //删除角色资源权限关联表
        RoleResourcePermissionDto roleResourcePermissionDto = new RoleResourcePermissionDto();
        roleResourcePermissionDto.setPermissionId(id);
        roleResourcePermissionService.deleteByKey(roleResourcePermissionDto);
        //删除权限表
        return permissionService.delete(id);
    }
}
